<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>借款方管理</title>
    <link rel="stylesheet" href="../../../static/layer/css/layui.css" media="all"/>
    <link rel="stylesheet" href="../../../static/css/font-awesome.min.css" media="all">

</head>

<body>

<div style="padding: 20px; position: relative;">
    <div class="operateTable">
        借款方名称：
        <div class="layui-inline">
            <input class="layui-input" name="id" id="filter-id" placeholder="借款方名称" autocomplete="off">
        </div>
        <button class="layui-btn" data-type="reload">搜索</button>
    </div>

    <table class="layui-table" id='buildingTable' lay-filter="business">
    </table>

   <div id="barDemo" style="display:none;">
        <a class="layui-btn layui-btn-primary layui-btn-mini " lay-event="detail" data-type="detail">查看</a>
    </div>

</div>

<script type="text/javascript" src="../../../static/layer/layui.js"></script>
<script>
    var table;
    var businessId = "";
    layui.use(['jquery', 'table', 'form', 'layer', 'element'], function () {
        table = layui.table;
        var $ = layui.jquery,
            element = layui.element, //导航的hover效果、二级菜单等功能，需要依赖element模块
            form = layui.form;


        var active = {
            reload: function () {
                var name = $('#filter-id').val();
                reloadTable(name);
            }

        };

        //监听工具条
        table.on('tool(business)', function (obj) {

            debugger
            var data = obj.data;
            if (obj.event === 'detail') {
                layer.open({
                    type: 2,
                    title: "出借企业信息",
                    shadeClose: false,
                    shade: [0.3],
                    maxmin: true, //开启最大化最小化按钮
                    area: ['50%', '90%'],
                    scrollbar: false, //屏蔽滚动条
                    content: 'borrowerShow.html?ID='+data.ID
                });
            }


        });
        active.reload();

        function reloadTable(name) {
            var data = {};
            if (!!name) {
                data.COMPANY_NAME = name;
            }
            table.render({
                elem: '#buildingTable',
                url: '/financial/BorrowerList/',
                page: true,
                limit: 20,
                height: 'full-150',
                where: data,
                cols: [[
                    {field: 'ROWNUM', fixed: true, width: 70}
                    , {field: 'COMPANY_NAME', title: '借款方名称', width: 250}
                    , {field: 'SIGNER', title: '签订人姓名', width: 150}
                    , {field: 'SIGNER_TEL', title: '签订人联系方式', width: 200}
                    , {field: 'BUSINESS_LICENSE', title: '统一社会信用代码', width: 200}
                    , {field: 'CONTRACT_ADDRESS', title: '通讯地址', width: 200}

                    , {fixed: 'right', title: '操作', width: 200, align: 'center', toolbar: '#barDemo'}

                ]]
            });
        }

        $('.operateTable .layui-btn').on('click', function () {
            var type = $(this).data('type');
            // alert(type);
            active[type] ? active[type].call(this) : '';
        });
    });




</script>

<script type="text/javascript" src="../../../static/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="../../../static/js/common/authUtils.js"></script>
</body>

</html>